<%--
  Created by GHW.
  Date: 2019/11/14
  Time: 23:02
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>修改密码</title>
</head>
<body>
<form method="post" action="UpdatePasswordServlet">
    <input type="text" hidden="hidden" name="id" value="${userInfo.id}">
    <input type="password" id="oldPassword" name="oldPassword" placeholder="请输入原密码">
    <input type="password" id="newPassword" name="newPassword" placeholder="请输入新密码">
    <input type="password" id="confirmNewPassword" name="confirmNewPassword" placeholder="请确认新密码">
    <input type="submit" value="确认">
</form>


<script type="text/javascript">

    $(function () {
        $("#register").click(function () {
            var newPassword = $("input[name='newPassword']").val();
            var confirmNewPassword = $("input[name='confirmNewPassword']").val();
            if (newPassword === '' || confirmNewPassword === '') {
                alert('密码，确认密码不能为空')
            } else if (newPassword !== confirmNewPassword) {
                alert("两次密码不一致!");
                $("input[name='newPassword']").val("");
                $("input[name='confirmNewPassword']").val("");
            } else {
                alert("修改成功！");
            }
        });
    });
</script>
</body>
</html>
